namespace C4F.DevKit.Bluetooth.ObjectExchange
{
    /// <summary>
    /// Interface representing the data that will be required to create
    /// an Authenticate Challenge header. This class should be inherited and
    /// implementation should be provided for methods GenerateNonce() and
    /// GenerateRequestDigest().
    /// </summary>
    public interface IAuthenticateChallenge
    {
        #region Properties

        /// <summary>
        /// Gets or sets the private key used by the security model.
        /// </summary>
        byte[] PrivateKey
        {
            get;
            set;
        }

        /// <summary>
        /// Gets the Nonce value used in the security model.
        /// </summary>
        byte[] Nonce
        {
            get;
        }

        /// <summary>
        /// Gets or sets a value indicating whether userId must be sent in
        /// Authenticate Response.
        /// Setting of this property is optional. 
        /// </summary>
        bool RequestUserId
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets a value indicating the AccessMode to be used: ReadOnly
        /// when set, otherwise Full access is permitted.
        /// Setting of this property is optional. 
        /// </summary>
        bool ReadOnly
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the realm to be sent.
        /// The realm is intended to be displayed to users so they know which
        /// userid and password to use.
        /// Setting of this property is optional. 
        /// </summary>
        string Realm
        {
            get;
            set;
        }

        #endregion

        #region Functions/Methods

        /// <summary>
        /// Method for nonce generation. This method is expected to set the
        /// nonce value in the class after successful completion. Note that 
        /// the nonce value should be a byte array of length 16.
        /// </summary>
        /// <param name="hashingParameters">Array of parameters that will be
        /// used in by the hashing algorithm for nonce generation.</param>
        /// <returns>Value indicating the success or failure of the operation.
        /// </returns>
        bool GenerateNonce(params object[] hashingParameters);

        /// <summary>
        /// Method for generating request digest. Assumes that the nonce value
        /// has been set. Note that the Reqest Digest value should be a byte 
        /// array of length 16.
        /// </summary>
        /// <returns>16 byte Request Digest.</returns>
        byte[] GenerateRequestDigest();

        #endregion
    }
}